var User = (function($) {
	return {
		initEditEvent : function() {
			$("#user_type").change(function() {
				User.userSettingConstrain();
			});
		},
		userSettingConstrain : function() {
			var userType = $("#user_type").val();

			User.showHide($("#agent_id").closest("li"),userType == "USER");
			User.showHide($("#affiliate_id").closest("li"),userType == "USER");
			User.showHide($("#commission_rate").closest("li"),userType == "USER");
			User.showHide($("#agent_rate").closest("li"),userType == "AGENT");
			User.showHide($("#affiliate_rate").closest("li"),userType == "AFFILIATE");
			User.showHide($("#affiliate_commission_rate").closest("li"),userType == "AFFILIATE");			
		},
		showHide : function(selector, isShow) {
			if (isShow) {
				selector.show();
			} else {
				selector.hide();
			}

		}
	};
})(jQuery);
